<?php


/**
 * Base class that represents a query for the 'mbo_goals' table.
 *
 *
 *
 * @method EmpevalMboGoalsQuery orderById($order = Criteria::ASC) Order by the id column
 * @method EmpevalMboGoalsQuery orderByBonusGoalsFormId($order = Criteria::ASC) Order by the bonus_goals_form_id column
 * @method EmpevalMboGoalsQuery orderByBonusGoalDesc($order = Criteria::ASC) Order by the bonus_goal_desc column
 * @method EmpevalMboGoalsQuery orderByMeasuredVariable($order = Criteria::ASC) Order by the measured_variable column
 * @method EmpevalMboGoalsQuery orderByDeadline($order = Criteria::ASC) Order by the deadline column
 * @method EmpevalMboGoalsQuery orderByWeightingFactor($order = Criteria::ASC) Order by the weighting_factor column
 * @method EmpevalMboGoalsQuery orderByDegreeOfFulfillment($order = Criteria::ASC) Order by the degree_of_fulfillment column
 * @method EmpevalMboGoalsQuery orderByType($order = Criteria::ASC) Order by the type column
 * @method EmpevalMboGoalsQuery orderByStatus($order = Criteria::ASC) Order by the status column
 * @method EmpevalMboGoalsQuery orderByLastModified($order = Criteria::ASC) Order by the last_modified column
 * @method EmpevalMboGoalsQuery orderByCreated($order = Criteria::ASC) Order by the created column
 *
 * @method EmpevalMboGoalsQuery groupById() Group by the id column
 * @method EmpevalMboGoalsQuery groupByBonusGoalsFormId() Group by the bonus_goals_form_id column
 * @method EmpevalMboGoalsQuery groupByBonusGoalDesc() Group by the bonus_goal_desc column
 * @method EmpevalMboGoalsQuery groupByMeasuredVariable() Group by the measured_variable column
 * @method EmpevalMboGoalsQuery groupByDeadline() Group by the deadline column
 * @method EmpevalMboGoalsQuery groupByWeightingFactor() Group by the weighting_factor column
 * @method EmpevalMboGoalsQuery groupByDegreeOfFulfillment() Group by the degree_of_fulfillment column
 * @method EmpevalMboGoalsQuery groupByType() Group by the type column
 * @method EmpevalMboGoalsQuery groupByStatus() Group by the status column
 * @method EmpevalMboGoalsQuery groupByLastModified() Group by the last_modified column
 * @method EmpevalMboGoalsQuery groupByCreated() Group by the created column
 *
 * @method EmpevalMboGoalsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method EmpevalMboGoalsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method EmpevalMboGoalsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method EmpevalMboGoalsQuery leftJoinBonusGoalsForms($relationAlias = null) Adds a LEFT JOIN clause to the query using the BonusGoalsForms relation
 * @method EmpevalMboGoalsQuery rightJoinBonusGoalsForms($relationAlias = null) Adds a RIGHT JOIN clause to the query using the BonusGoalsForms relation
 * @method EmpevalMboGoalsQuery innerJoinBonusGoalsForms($relationAlias = null) Adds a INNER JOIN clause to the query using the BonusGoalsForms relation
 *
 * @method EmpevalMboGoalsQuery leftJoinViewBgfWithSuperiorPositionId($relationAlias = null) Adds a LEFT JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
 * @method EmpevalMboGoalsQuery rightJoinViewBgfWithSuperiorPositionId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
 * @method EmpevalMboGoalsQuery innerJoinViewBgfWithSuperiorPositionId($relationAlias = null) Adds a INNER JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
 *
 * @method EmpevalMboGoals findOne(PropelPDO $con = null) Return the first EmpevalMboGoals matching the query
 * @method EmpevalMboGoals findOneOrCreate(PropelPDO $con = null) Return the first EmpevalMboGoals matching the query, or a new EmpevalMboGoals object populated from the query conditions when no match is found
 *
 * @method EmpevalMboGoals findOneById(int $id) Return the first EmpevalMboGoals filtered by the id column
 * @method EmpevalMboGoals findOneByBonusGoalsFormId(int $bonus_goals_form_id) Return the first EmpevalMboGoals filtered by the bonus_goals_form_id column
 * @method EmpevalMboGoals findOneByBonusGoalDesc(string $bonus_goal_desc) Return the first EmpevalMboGoals filtered by the bonus_goal_desc column
 * @method EmpevalMboGoals findOneByMeasuredVariable(string $measured_variable) Return the first EmpevalMboGoals filtered by the measured_variable column
 * @method EmpevalMboGoals findOneByDeadline(string $deadline) Return the first EmpevalMboGoals filtered by the deadline column
 * @method EmpevalMboGoals findOneByWeightingFactor(int $weighting_factor) Return the first EmpevalMboGoals filtered by the weighting_factor column
 * @method EmpevalMboGoals findOneByDegreeOfFulfillment(int $degree_of_fulfillment) Return the first EmpevalMboGoals filtered by the degree_of_fulfillment column
 * @method EmpevalMboGoals findOneByType(int $type) Return the first EmpevalMboGoals filtered by the type column
 * @method EmpevalMboGoals findOneByStatus(int $status) Return the first EmpevalMboGoals filtered by the status column
 * @method EmpevalMboGoals findOneByLastModified(string $last_modified) Return the first EmpevalMboGoals filtered by the last_modified column
 * @method EmpevalMboGoals findOneByCreated(string $created) Return the first EmpevalMboGoals filtered by the created column
 *
 * @method array findById(int $id) Return EmpevalMboGoals objects filtered by the id column
 * @method array findByBonusGoalsFormId(int $bonus_goals_form_id) Return EmpevalMboGoals objects filtered by the bonus_goals_form_id column
 * @method array findByBonusGoalDesc(string $bonus_goal_desc) Return EmpevalMboGoals objects filtered by the bonus_goal_desc column
 * @method array findByMeasuredVariable(string $measured_variable) Return EmpevalMboGoals objects filtered by the measured_variable column
 * @method array findByDeadline(string $deadline) Return EmpevalMboGoals objects filtered by the deadline column
 * @method array findByWeightingFactor(int $weighting_factor) Return EmpevalMboGoals objects filtered by the weighting_factor column
 * @method array findByDegreeOfFulfillment(int $degree_of_fulfillment) Return EmpevalMboGoals objects filtered by the degree_of_fulfillment column
 * @method array findByType(int $type) Return EmpevalMboGoals objects filtered by the type column
 * @method array findByStatus(int $status) Return EmpevalMboGoals objects filtered by the status column
 * @method array findByLastModified(string $last_modified) Return EmpevalMboGoals objects filtered by the last_modified column
 * @method array findByCreated(string $created) Return EmpevalMboGoals objects filtered by the created column
 *
 * @package    propel.generator.empeval.om
 */
abstract class EmpevalBaseMboGoalsQuery extends ModelCriteria
{
    /**
     * Initializes internal state of EmpevalBaseMboGoalsQuery object.
     *
     * @param     string $dbName The dabase name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = 'vgp_empeval', $modelName = 'EmpevalMboGoals', $modelAlias = null)
    {
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new EmpevalMboGoalsQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param     EmpevalMboGoalsQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return EmpevalMboGoalsQuery
     */
    public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof EmpevalMboGoalsQuery) {
            return $criteria;
        }
        $query = new EmpevalMboGoalsQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     * <code>
     * $obj  = $c->findPk(12, $con);
     * </code>
     *
     * @param mixed $key Primary key to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return   EmpevalMboGoals|EmpevalMboGoals[]|mixed the result, formatted by the current formatter
     */
    public function findPk($key, $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = EmpevalMboGoalsPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
            // the object is alredy in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getConnection(EmpevalMboGoalsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return   EmpevalMboGoals A model object, or null if the key is not found
     * @throws   PropelException
     */
    protected function findPkSimple($key, $con)
    {
        $sql = 'SELECT ID, BONUS_GOALS_FORM_ID, BONUS_GOAL_DESC, MEASURED_VARIABLE, DEADLINE, WEIGHTING_FACTOR, DEGREE_OF_FULFILLMENT, TYPE, STATUS, LAST_MODIFIED, CREATED FROM mbo_goals WHERE ID = :p0';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $obj = new EmpevalMboGoals();
            $obj->hydrate($row);
            EmpevalMboGoalsPeer::addInstanceToPool($obj, (string) $key);
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return EmpevalMboGoals|EmpevalMboGoals[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    }

    /**
     * Find objects by primary key
     * <code>
     * $objs = $c->findPks(array(12, 56, 832), $con);
     * </code>
     * @param     array $keys Primary keys to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return PropelObjectCollection|EmpevalMboGoals[]|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($stmt);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {

        return $this->addUsingAlias(EmpevalMboGoalsPeer::ID, $key, Criteria::EQUAL);
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {

        return $this->addUsingAlias(EmpevalMboGoalsPeer::ID, $keys, Criteria::IN);
    }

    /**
     * Filter the query on the id column
     *
     * Example usage:
     * <code>
     * $query->filterById(1234); // WHERE id = 1234
     * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
     * $query->filterById(array('min' => 12)); // WHERE id > 12
     * </code>
     *
     * @param     mixed $id The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterById($id = null, $comparison = null)
    {
        if (is_array($id) && null === $comparison) {
            $comparison = Criteria::IN;
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::ID, $id, $comparison);
    }

    /**
     * Filter the query on the bonus_goals_form_id column
     *
     * Example usage:
     * <code>
     * $query->filterByBonusGoalsFormId(1234); // WHERE bonus_goals_form_id = 1234
     * $query->filterByBonusGoalsFormId(array(12, 34)); // WHERE bonus_goals_form_id IN (12, 34)
     * $query->filterByBonusGoalsFormId(array('min' => 12)); // WHERE bonus_goals_form_id > 12
     * </code>
     *
     * @see       filterByBonusGoalsForms()
     *
     * @see       filterByViewBgfWithSuperiorPositionId()
     *
     * @param     mixed $bonusGoalsFormId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByBonusGoalsFormId($bonusGoalsFormId = null, $comparison = null)
    {
        if (is_array($bonusGoalsFormId)) {
            $useMinMax = false;
            if (isset($bonusGoalsFormId['min'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::BONUS_GOALS_FORM_ID, $bonusGoalsFormId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($bonusGoalsFormId['max'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::BONUS_GOALS_FORM_ID, $bonusGoalsFormId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::BONUS_GOALS_FORM_ID, $bonusGoalsFormId, $comparison);
    }

    /**
     * Filter the query on the bonus_goal_desc column
     *
     * Example usage:
     * <code>
     * $query->filterByBonusGoalDesc('fooValue');   // WHERE bonus_goal_desc = 'fooValue'
     * $query->filterByBonusGoalDesc('%fooValue%'); // WHERE bonus_goal_desc LIKE '%fooValue%'
     * </code>
     *
     * @param     string $bonusGoalDesc The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByBonusGoalDesc($bonusGoalDesc = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($bonusGoalDesc)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $bonusGoalDesc)) {
                $bonusGoalDesc = str_replace('*', '%', $bonusGoalDesc);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::BONUS_GOAL_DESC, $bonusGoalDesc, $comparison);
    }

    /**
     * Filter the query on the measured_variable column
     *
     * Example usage:
     * <code>
     * $query->filterByMeasuredVariable('fooValue');   // WHERE measured_variable = 'fooValue'
     * $query->filterByMeasuredVariable('%fooValue%'); // WHERE measured_variable LIKE '%fooValue%'
     * </code>
     *
     * @param     string $measuredVariable The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByMeasuredVariable($measuredVariable = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($measuredVariable)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $measuredVariable)) {
                $measuredVariable = str_replace('*', '%', $measuredVariable);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::MEASURED_VARIABLE, $measuredVariable, $comparison);
    }

    /**
     * Filter the query on the deadline column
     *
     * Example usage:
     * <code>
     * $query->filterByDeadline('2011-03-14'); // WHERE deadline = '2011-03-14'
     * $query->filterByDeadline('now'); // WHERE deadline = '2011-03-14'
     * $query->filterByDeadline(array('max' => 'yesterday')); // WHERE deadline > '2011-03-13'
     * </code>
     *
     * @param     mixed $deadline The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByDeadline($deadline = null, $comparison = null)
    {
        if (is_array($deadline)) {
            $useMinMax = false;
            if (isset($deadline['min'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::DEADLINE, $deadline['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($deadline['max'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::DEADLINE, $deadline['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::DEADLINE, $deadline, $comparison);
    }

    /**
     * Filter the query on the weighting_factor column
     *
     * Example usage:
     * <code>
     * $query->filterByWeightingFactor(1234); // WHERE weighting_factor = 1234
     * $query->filterByWeightingFactor(array(12, 34)); // WHERE weighting_factor IN (12, 34)
     * $query->filterByWeightingFactor(array('min' => 12)); // WHERE weighting_factor > 12
     * </code>
     *
     * @param     mixed $weightingFactor The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByWeightingFactor($weightingFactor = null, $comparison = null)
    {
        if (is_array($weightingFactor)) {
            $useMinMax = false;
            if (isset($weightingFactor['min'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::WEIGHTING_FACTOR, $weightingFactor['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($weightingFactor['max'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::WEIGHTING_FACTOR, $weightingFactor['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::WEIGHTING_FACTOR, $weightingFactor, $comparison);
    }

    /**
     * Filter the query on the degree_of_fulfillment column
     *
     * Example usage:
     * <code>
     * $query->filterByDegreeOfFulfillment(1234); // WHERE degree_of_fulfillment = 1234
     * $query->filterByDegreeOfFulfillment(array(12, 34)); // WHERE degree_of_fulfillment IN (12, 34)
     * $query->filterByDegreeOfFulfillment(array('min' => 12)); // WHERE degree_of_fulfillment > 12
     * </code>
     *
     * @param     mixed $degreeOfFulfillment The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByDegreeOfFulfillment($degreeOfFulfillment = null, $comparison = null)
    {
        if (is_array($degreeOfFulfillment)) {
            $useMinMax = false;
            if (isset($degreeOfFulfillment['min'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::DEGREE_OF_FULFILLMENT, $degreeOfFulfillment['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($degreeOfFulfillment['max'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::DEGREE_OF_FULFILLMENT, $degreeOfFulfillment['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::DEGREE_OF_FULFILLMENT, $degreeOfFulfillment, $comparison);
    }

    /**
     * Filter the query on the type column
     *
     * Example usage:
     * <code>
     * $query->filterByType(1234); // WHERE type = 1234
     * $query->filterByType(array(12, 34)); // WHERE type IN (12, 34)
     * $query->filterByType(array('min' => 12)); // WHERE type > 12
     * </code>
     *
     * @param     mixed $type The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByType($type = null, $comparison = null)
    {
        if (is_array($type)) {
            $useMinMax = false;
            if (isset($type['min'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::TYPE, $type['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($type['max'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::TYPE, $type['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::TYPE, $type, $comparison);
    }

    /**
     * Filter the query on the status column
     *
     * Example usage:
     * <code>
     * $query->filterByStatus(1234); // WHERE status = 1234
     * $query->filterByStatus(array(12, 34)); // WHERE status IN (12, 34)
     * $query->filterByStatus(array('min' => 12)); // WHERE status > 12
     * </code>
     *
     * @param     mixed $status The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByStatus($status = null, $comparison = null)
    {
        if (is_array($status)) {
            $useMinMax = false;
            if (isset($status['min'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::STATUS, $status['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($status['max'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::STATUS, $status['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::STATUS, $status, $comparison);
    }

    /**
     * Filter the query on the last_modified column
     *
     * Example usage:
     * <code>
     * $query->filterByLastModified('2011-03-14'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified('now'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified(array('max' => 'yesterday')); // WHERE last_modified > '2011-03-13'
     * </code>
     *
     * @param     mixed $lastModified The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByLastModified($lastModified = null, $comparison = null)
    {
        if (is_array($lastModified)) {
            $useMinMax = false;
            if (isset($lastModified['min'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::LAST_MODIFIED, $lastModified['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($lastModified['max'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::LAST_MODIFIED, $lastModified['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::LAST_MODIFIED, $lastModified, $comparison);
    }

    /**
     * Filter the query on the created column
     *
     * Example usage:
     * <code>
     * $query->filterByCreated('2011-03-14'); // WHERE created = '2011-03-14'
     * $query->filterByCreated('now'); // WHERE created = '2011-03-14'
     * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13'
     * </code>
     *
     * @param     mixed $created The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function filterByCreated($created = null, $comparison = null)
    {
        if (is_array($created)) {
            $useMinMax = false;
            if (isset($created['min'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::CREATED, $created['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($created['max'])) {
                $this->addUsingAlias(EmpevalMboGoalsPeer::CREATED, $created['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(EmpevalMboGoalsPeer::CREATED, $created, $comparison);
    }

    /**
     * Filter the query by a related EmpevalBonusGoalsForms object
     *
     * @param   EmpevalBonusGoalsForms|PropelObjectCollection $bonusGoalsForms The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   EmpevalMboGoalsQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByBonusGoalsForms($bonusGoalsForms, $comparison = null)
    {
        if ($bonusGoalsForms instanceof EmpevalBonusGoalsForms) {
            return $this
                ->addUsingAlias(EmpevalMboGoalsPeer::BONUS_GOALS_FORM_ID, $bonusGoalsForms->getId(), $comparison);
        } elseif ($bonusGoalsForms instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(EmpevalMboGoalsPeer::BONUS_GOALS_FORM_ID, $bonusGoalsForms->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByBonusGoalsForms() only accepts arguments of type EmpevalBonusGoalsForms or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the BonusGoalsForms relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function joinBonusGoalsForms($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('BonusGoalsForms');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'BonusGoalsForms');
        }

        return $this;
    }

    /**
     * Use the BonusGoalsForms relation BonusGoalsForms object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   EmpevalBonusGoalsFormsQuery A secondary query class using the current class as primary query
     */
    public function useBonusGoalsFormsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinBonusGoalsForms($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'BonusGoalsForms', 'EmpevalBonusGoalsFormsQuery');
    }

    /**
     * Filter the query by a related EmpevalViewBgfWithSuperiorPositionId object
     *
     * @param   EmpevalViewBgfWithSuperiorPositionId|PropelObjectCollection $viewBgfWithSuperiorPositionId The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   EmpevalMboGoalsQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByViewBgfWithSuperiorPositionId($viewBgfWithSuperiorPositionId, $comparison = null)
    {
        if ($viewBgfWithSuperiorPositionId instanceof EmpevalViewBgfWithSuperiorPositionId) {
            return $this
                ->addUsingAlias(EmpevalMboGoalsPeer::BONUS_GOALS_FORM_ID, $viewBgfWithSuperiorPositionId->getId(), $comparison);
        } elseif ($viewBgfWithSuperiorPositionId instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(EmpevalMboGoalsPeer::BONUS_GOALS_FORM_ID, $viewBgfWithSuperiorPositionId->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByViewBgfWithSuperiorPositionId() only accepts arguments of type EmpevalViewBgfWithSuperiorPositionId or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the ViewBgfWithSuperiorPositionId relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function joinViewBgfWithSuperiorPositionId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('ViewBgfWithSuperiorPositionId');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'ViewBgfWithSuperiorPositionId');
        }

        return $this;
    }

    /**
     * Use the ViewBgfWithSuperiorPositionId relation ViewBgfWithSuperiorPositionId object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   EmpevalViewBgfWithSuperiorPositionIdQuery A secondary query class using the current class as primary query
     */
    public function useViewBgfWithSuperiorPositionIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinViewBgfWithSuperiorPositionId($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'ViewBgfWithSuperiorPositionId', 'EmpevalViewBgfWithSuperiorPositionIdQuery');
    }

    /**
     * Exclude object from result
     *
     * @param   EmpevalMboGoals $mboGoals Object to remove from the list of results
     *
     * @return EmpevalMboGoalsQuery The current query, for fluid interface
     */
    public function prune($mboGoals = null)
    {
        if ($mboGoals) {
            $this->addUsingAlias(EmpevalMboGoalsPeer::ID, $mboGoals->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }

}
